<?php
require_once BaseUtil::getModulePath("base") . '/models/BaseDao.php';

class LogDao extends BaseDao {
    protected $_name;
    protected $joinAgent;
    public function _setup(){
        $this->_name="logs";
        //$this->joinAgent = "agents";
        parent::_setup();
    }

    public function addLog($log){
        return $this->insertData($log);
    }
    public function getSystemLogById($id){
        $select=$this->db_r->select();
        $select->from($this->_name);
        //$select->joinLeft($this->joinAgent,$this->_name.".user_id=$this->joinAgent.user_id",'*');
        $select->where($this->_name.'.id=?',$id);
        $select->where($this->_name.'.is_delete=?',0);
        $sql=$select->__toString();
        return $this->db_r->fetchRow($sql);
    }

    public function deleteSystemLog($id){
        $set = array('is_delete' => 1);
        $where = $this->db_w->quoteInto('id=?', $id);
        $this->updateData($set, $where);
    }
}
?>